package com.vanke.devops.domain.manager.docker.extend.command.impl;

import com.github.dockerjava.api.command.DockerCmdSyncExec;
import com.github.dockerjava.core.command.AbstrDockerCmd;
import com.github.dockerjava.core.util.FiltersBuilder;
import com.vanke.devops.domain.manager.docker.extend.command.ListTasksCmd;
import com.vanke.devops.domain.manager.docker.extend.model.Task;

import java.util.List;
import java.util.Map;

/**
 * @author 陈景阳
 * @since 2018/6/8
 */
public class ListTasksCmdImpl extends AbstrDockerCmd<ListTasksCmd,List<Task>> implements ListTasksCmd {

    private FiltersBuilder filters = new FiltersBuilder();

    public ListTasksCmdImpl(DockerCmdSyncExec<ListTasksCmd, List<Task>> execution) {
        super(execution);
    }

    @Override
    public Map<String, List<String>> getFilters() {
        return filters.build();
    }

    @Override
    public ListTasksCmd withServiceName(String serviceName) {
        filters.withFilter("service",serviceName);
        return this;
    }
}
